<template>
  <div class="container" ref="mainCon">
    <div class="mainCon">
      <el-row class="toolbar searchInputWidth" style="padding-bottom: 0">
        <el-form :inline="true" :model="filterField" ref="searchConditions">
          <el-col :lg="8" :xl="6">
            <el-form-item label="参建单位" class="row-padding-bottom">
              <el-select
                v-model="filterField.projectCompanyId"
                clearable
                filterable
                placeholder="请选择"
                :disabled="isFB"
              >
                <el-option
                  v-for="(item, index) of companyList"
                  :key="index"
                  :label="item.name"
                  :value="item.code"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :lg="8" :xl="6">
            <el-form-item label="班组名称" class="row-padding-bottom name">
              <el-input
                placeholder="请输入内容"
                clearable
                v-model="filterField.groupName"
                @blur="filterField.groupName = changeValue($event)"
              ></el-input>
            </el-form-item>
          </el-col>
          <template v-if="advanced">
            <el-col :lg="8" :xl="6">
              <el-form-item label="班组类型" class="row-padding-bottom">
                <el-select
                  v-model="filterField.type"
                  clearable
                  filterable
                  placeholder="请选择"
                >
                  <el-option
                    v-for="(item, index) of groupTypeList"
                    :key="index"
                    :label="item.name"
                    :value="item.code"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <!-- <el-col :lg="8" :xl="6">
                        <el-form-item>
                            <el-button type="primary" icon="icon iconfont iconchazhao1" @click="searchList" class="commonBtn"></el-button>
                        </el-form-item>
                        </el-col> -->
          </template>
          <el-col :lg="8" :xl="6">
            <el-form-item label="">
              <a
                @click="toggleAdvanced"
                style="margin-left: 40px; color: #409eff; cursor: pointer"
                class="btnColor"
              >
                {{ advanced ? '收起' : '展开' }}
                <i
                  :class="advanced ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
                ></i>
              </a>
              <el-button
                type="primary"
                icon="icon iconfont iconchazhao1"
                @click="searchList"
                class="searchBtn"
              >
                <span>搜索</span>
              </el-button>
            </el-form-item>
            <el-form-item v-if="jcProjectId">
              <exportBtn
                :dataLen="tableList.length"
                :filterField="filterField"
                api="api-s/report/export_QY_GROUP"
              ></exportBtn>
            </el-form-item>
          </el-col>

          <!-- <el-form-item  class="fl" v-if = "!jcProjectId" style = "margin-right:0;width:440px">
                           <el-button class="commonBut saveBtn funComBut" icon="icon iconfont icontianjia" v-show="isShowAdd" @click="toAddGroup">
                                <span class="opetareText">添加班组</span>
                            </el-button>
                        </el-form-item> -->
        </el-form>
      </el-row>
      <div class="spacing"></div>
      <div
        ref="tableBox"
        :class="hiddleToolBar ? 'tableBoxCur tableBox' : 'tableBoxCur'"
      >
        <div style="margin-bottom: 24px" v-if="!jcProjectId">
          <el-button
            class="commonBut saveBtn funComBut"
            icon="icon iconfont icontianjia"
            v-show="isShowAdd"
            @click="toAddGroup"
          >
            <span class="opetareText">添加班组</span>
          </el-button>
          <exportBtn
            :dataLen="tableList.length"
            :filterField="filterField"
            api="api-s/report/export_QY_GROUP"
          ></exportBtn>
        </div>
        <el-table
          ref="tableBox1"
          :max-height="tableHeight"
          :data="tableList"
          :header-cell-style="{ background: '#eef1f6', color: '#606266' }"
          highlight-current-row
          stripe
          v-loading="loading"
          style="border: 1px solid #dfe6ec"
        >
          <el-table-column
            prop="groupName"
            label="班组名称"
            min-width="230"
            align="left"
            :formatter="formatTd"
          ></el-table-column>
          <!-- <el-table-column  prop="companyName" label="所属参建单位" align="center" :formatter=formatTd></el-table-column> -->
          <el-table-column
            prop="companyName"
            label="所属参建单位"
            min-width="230"
          >
            <template slot-scope="scope">
              <copyText
                :tableIndex="scope.$index"
                :copyTextName="scope.row.companyName"
                :columnName="'companyName'"
              ></copyText>
            </template>
          </el-table-column>
          <el-table-column
            prop="type"
            label="班组类型"
            align="center"
            min-width="230"
            :formatter="formatTd"
          ></el-table-column>
          <el-table-column label="操作" align="left" width="180" fixed="right">
            <template slot-scope="scope">
              <el-link
                type="primary"
                @click="showDetail(scope.row)"
                v-show="isShowDetail"
                >查看</el-link
              >
              <el-link
                type="primary"
                @click="editDetail(scope.row)"
                v-if="
                  isShowUpdate &&
                  filterField.sysAppCode == 'owner' &&
                  scope.row.companyType == '0'
                "
                >编辑</el-link
              >
              <el-link
                type="primary"
                @click="editDetail(scope.row)"
                v-else-if="
                  isShowUpdate &&
                  filterField.sysAppCode == 'constructor' &&
                  scope.row.companyType == '5'
                "
                >编辑</el-link
              >
              <el-link
                type="primary"
                @click="editDetail(scope.row)"
                v-else-if="isShowUpdate && filterField.sysAppCode == 'project'"
                >编辑</el-link
              >
              <el-link
                type="primary"
                @click="editDetail(scope.row)"
                v-else-if="isShowUpdate && userType !== 'QY'"
                >编辑</el-link
              >
              <el-link
                type="primary"
                @click="toDel(scope.row)"
                v-if="
                  scope.row.total < 1 &&
                  isShowDel &&
                  (filterField.sysAppCode == 'constructor' ||
                    filterField.sysAppCode == '	project') &&
                  scope.row.companyType == '5'
                "
                >删除</el-link
              >
              <el-link
                type="primary"
                @click="toDel(scope.row)"
                v-else-if="
                  scope.row.total < 1 && isShowDel && userType !== 'QY'
                "
                >删除</el-link
              >
            </template>
          </el-table-column>
          <!-- 表格数据为空时，页面显示 -->
          <div slot="empty" v-show="isShow">
            <emptyTable emptyText="暂无相关信息"></emptyTable>
          </div>
        </el-table>
        <!-- filterField为搜索条件 -->
        <!-- getTableList为获取子组件的数据 -->
        <Pagination
          ref="pagination"
          @getpageNo="getpageNo"
          @getpageSize="getpageSize"
          @getList="getTableList"
          :filterField="filterField"
          :requestUrl="requestUrl"
        ></Pagination>
      </div>
    </div>
    <el-dialog
      :title="addOrEdit == 0 ? '添加班组' : '修改班组'"
      width="640px"
      :visible.sync="formVisible"
      :close-on-click-modal="false"
      @close="cancel('formData')"
      custom-class="brand-dialog-min-width"
      :append-to-body="true"
      :modal-append-to-body="false"
    >
      <el-form
        :model="formData"
        :rules="formRules"
        label-width="120px"
        ref="formData"
      >
        <el-form-item label="项目名称：">
          {{ formData.projectName || '--' }}
        </el-form-item>
        <el-form-item label="班组名称：" prop="groupName">
          <el-input
            class="dialogSingleInp"
            v-model="formData.groupName"
            autocomplete="off"
            placeholder="请输入"
            @blur="formData.groupName = changeValue($event)"
          ></el-input>
        </el-form-item>
        <el-form-item label="班组类型：" prop="type">
          <el-select
            class="dialogSingleInp"
            v-model="formData.type"
            placeholder="请选择"
            clearable
            filterable
            :disabled="formData.projectTotal > 0"
          >
            <el-option
              v-for="(item, index) of groupTypeList"
              :key="index"
              :label="item.name"
              :value="item.code"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="所属参建单位：" prop="projectCompanyId">
          <el-select
            class="dialogSingleInp"
            v-model="formData.projectCompanyId"
            placeholder="请选择"
            clearable
            filterable
            :disabled="formData.projectTotal > 0 || userTypeState === 'COMPANY'"
          >
            <el-option
              v-for="(item, index) of companyList"
              :key="index"
              :label="item.name"
              :value="item.code"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item prop="pointId">
          <span slot="label">
            打卡点<el-tooltip
              content="Top center"
              placement="top"
              effect="dark"
            >
              <div slot="content">
                一个班組可选择多个打卡点，如未添加打卡地点，请在考動管理的考動规则设置中添加<br />
                班组下的现有人员、新增人员，系统都将自动关联所选择的打卡点
              </div>
              <i class="icon iconfont iconhuabanfuben"></i> </el-tooltip
            >：
          </span>
          <el-select
            class="dialogSingleInp"
            v-model="formData.pointId"
            placeholder="请选择"
            clearable
            filterable
            multiple
          >
            <el-option
              v-for="(item, index) of pointList"
              :key="index"
              :label="item.name"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="班组主要工作：" prop="account">
          <el-input
            type="textarea"
            placeholder="请输入班组主要工作内容"
            v-model="formData.remark"
            @blur="formData.remark = changeValue($event)"
            maxlength="200"
            show-word-limit
            class="dialogSingleInp"
            rows="3"
          ></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click.native="cancel('formData')" class="cancel"
          >取消</el-button
        >
        <el-button
          type="primary"
          @click.native="toSaveGroupInfo('formData')"
          class="save"
          :loading="canLogin"
          >保存</el-button
        >
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'constructGroup',
  data() {
    var validatorType = (rule, value, callback) => {
      if (!value) {
        callback(new Error('班组类型不能为空'))
      } else if (
        this.selectArr.length > 0 &&
        this.selectArr[0].type == '0' &&
        value !== '900'
      ) {
        callback(new Error('参建单位建设方的班组类型只能选择管理人员'))
      } else {
        callback()
      }
    }
    var projectCompanyId = (rule, value, callback) => {
      var arr = this.companyList.filter((v) => {
        if (v.code.indexOf(value) > -1) {
          return v
        }
      })
      this.selectArr = arr
      if (!value) {
        callback(new Error('参建单位不能为空'))
      } else if (this.formData.type != '') {
        this.$refs.formData.validateField('type')
        callback()
      } else {
        callback()
      }
    }
    return {
      hiddleToolBar: false,
      tableHeight: null,
      isShowDetail: '',
      advanced: false,
      //表格数据
      tableList: [],
      requestUrl: 'api-e/cs/group/expand/listbypage',
      //搜索条件
      filterField: {
        sysAppCode: localStorage.getItem('judgeRoleCode'),
        uscc: '',
        projectCompanyId: '',
        groupName: '',
        type: '',
        projectId: '',
      },
      pageSize: 20,
      pageNo: 1,
      companyList: [],
      groupTypeList: [],
      loading: true,
      isShow: false,
      //弹窗
      addOrEdit: 0,
      formVisible: false,
      formData: {
        id: '',
        projectName: '',
        projectId: '',
        groupName: '',
        type: '',
        projectCompanyId: '',
        remark: '',
        points: '',
        pointId: '',
      },
      canLogin: false,
      formLabelCardWidth: '125px',
      formRules: {
        groupName: [
          {
            required: true,
            pattern: /^[\s\S]*.*[^\s][\s\S]*$/,
            message: '班组名称不能为空',
            trigger: 'blur',
          },
        ],
        type: [
          {
            required: true,
            // message: "班组类型不能为空",
            trigger: 'change',
            validator: validatorType,
          },
        ],
        projectCompanyId: [
          {
            required: true,
            // message: "参建单位不能为空",
            trigger: 'change',
            validator: projectCompanyId,
          },
        ],
        pointId: [
          {
            required: true,
            message: '请选择打卡点名称',
            trigger: 'change',
          },
        ],
      },
      projectId: '',
      isShowUpdate: '',
      isShowDel: '',
      isShowAdd: '',
      userType: '', //用户类型
      pointList: [], //打卡点
      selectArr: [],
      userTypeState: '',
    }
  },
  props: {
    jcProjectId: {
      type: String,
      default: '',
    },
    projectItem: {
      type: String,
      default: '',
    },
    detailProjectName: {
      type: String,
      default: '',
    },
    isFB: {
      type: Boolean,
      default: false,
    },
  },
  created() {
    this.userType = localStorage.getItem('loginType')
    this.userTypeState = this.$store.state.userType
    // jcProjectId 监察端传过来的projectId
    if (!this.jcProjectId) {
      this.projectId = this.projectItem.code
    } else {
      this.projectId = this.jcProjectId
    }
    this.filterField.projectId = this.projectId

    if (!this.isFB) {
      this.$nextTick(function () {
        this.$refs.pagination.getTableListData(this.pageNo, this.pageSize)
      })
    }
    this.getCompanyList()
    this.getGroupTypeList()
    this.isShowDetail =
      this.$store.state.buttonLimitsArr.indexOf('csRosterFb:detail') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('csRoster:detail') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('mProjectList:detail') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('csRosterSGF:detail') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('csRosterJSF:detail') > -1
    this.isShowAdd =
      this.$store.state.buttonLimitsArr.indexOf('csRosterFb:add') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('csRoster:add') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('mProjectList:add') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('csRosterSGF:add') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('csRosterJSF:add') > -1
    this.isShowUpdate =
      this.$store.state.buttonLimitsArr.indexOf('csRosterFb:update') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('csRoster:update') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('mProjectList:update') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('csRosterSGF:update') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('csRosterJSF:update') > -1
    this.isShowDel =
      this.$store.state.buttonLimitsArr.indexOf('csRosterFb:delete') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('csRoster:delete') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('mProjectList:delete') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('csRosterSGF:delete') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('csRosterJSF:delete') > -1
    this.getPointList('')
  },
  activated() {
    window.addEventListener('scroll', this.handleScroll, true)
    if (!this.isFB) {
      this.$nextTick(function () {
        this.$refs.pagination.getTableListData(this.pageNo, this.pageSize)
      })
    }
    this.$nextTick(function () {
      this.$refs.tableBox1.doLayout()
    })
  },
  deactivated() {
    let that = this
    window.removeEventListener('scroll', that.handleScroll, true)
  },
  beforeDestroy() {
    let that = this
    window.removeEventListener('scroll', that.handleScroll, true)
  },
  methods: {
    handleScroll(e) {
      this.$nextTick(function () {
        //变量scrollTop是滚动条滚动时，距离顶部的距离
        var scrollTop = e.target.scrollTop
        if (
          this.$refs.tableBox &&
          this.$refs.tableBox.getBoundingClientRect().top < 128
        ) {
          this.tableHeight = window.innerHeight - 240
          if (document.getElementsByClassName('tableBoxCur').length) {
            document.getElementsByClassName('tableBoxCur')[0].style.height =
              null
          }
          this.hiddleToolBar = true
        } else {
          this.hiddleToolBar = false
        }
      })
    },
    toggleAdvanced() {
      this.advanced = !this.advanced
    },
    getpageSize(val) {
      this.pageSize = val
    },
    getpageNo(val) {
      this.pageNo = val
    },
    getTableList(data) {
      this.tableList = data
      this.loading = false
      if (this.tableList.length < 1) {
        this.isShow = true
      }
    },
    // 搜索
    searchList() {
      this.pageSize = 20
      this.pageNo = 1
      this.$refs.pagination.getTableListData()
    },
    showDetail(row) {
      if (this.isFB) {
        this.$router.push({
          path: '/home/employee/constructGroupDetail',
          name: 'constructGroupDetail',
          query: {
            id: row.id,
            projectId: this.projectId,
            projectName: this.projectItem
              ? this.projectItem.name
              : this.detailProjectName,
            type: this.projectItem ? '' : 'jcDetail',
            isFB: true,
          },
        })
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/employee/projectEmployeeFb',
          newUrl: this.$router.currentRoute.fullPath,
        })
      } else {
        this.$router.push({
          path: '/home/employee/constructGroupDetail',
          name: 'constructGroupDetail',
          query: {
            id: row.id,
            projectId: this.projectId,
            projectName: this.projectItem
              ? this.projectItem.name
              : this.detailProjectName,
            type: this.projectItem ? '' : 'jcDetail',
          },
        })
        if (this.projectItem) {
          this.$store.commit('CHANGE_SLIDER_NAME', {
            oldUrl: '/home/employee/projectEmployeeQY',
            newUrl: this.$router.currentRoute.fullPath,
          })
        } else if (
          !this.projectItem &&
          (this.userType === 'QY' || this.userType === 'XM')
        ) {
          //企业看板班组管理
          this.$store.commit('CHANGE_SLIDER_NAME', {
            oldUrl: '/home/project/projectListQY',
            newUrl: this.$router.currentRoute.fullPath,
          })
        } else {
          this.$store.commit('CHANGE_SLIDER_NAME', {
            oldUrl: '/home/project/projectList',
            newUrl: this.$router.currentRoute.fullPath,
          })
        }
      }

      // if(this.projectItem) {
      //     this.$store.commit("CHANGE_SLIDER_NAME", {oldUrl:"/home/employee/projectEmployeeQY",newUrl:this.$router.currentRoute.fullPath});
      // }else {
      //     this.$store.commit("CHANGE_SLIDER_NAME", {oldUrl:"/home/project/projectList",newUrl:this.$router.currentRoute.fullPath});
      // }
    },
    toAddGroup() {
      this.addOrEdit = 0
      this.formVisible = true
      this.selectArr = []
      if (this.userType === 'QY') {
        var projectCompanyId
        for (var i = 0; i < this.companyList.length; i++) {
          if (localStorage.getItem('judgeRoleCode') === 'owner') {
            if (this.companyList[i].type == '0') {
              projectCompanyId = this.companyList[i].code
            }
          } else {
            if (this.companyList[i].type == '5') {
              projectCompanyId = this.companyList[i].code
            }
          }
        }
        this.formData = {
          id: '',
          projectName: this.projectItem.name
            ? this.projectItem.name
            : this.detailProjectName,
          projectId: this.projectId,
          groupName: '',
          type: '',
          projectCompanyId: projectCompanyId,
          remark: '',
          points: '',
          pointId: '',
        }
      } else {
        this.formData = {
          id: '',
          projectName: this.projectItem.name
            ? this.projectItem.name
            : this.detailProjectName,
          projectId: this.projectId,
          groupName: '',
          type: '',
          projectCompanyId: '',
          remark: '',
          points: '',
          pointId: '',
        }
      }
      this.$nextTick(function () {
        this.$refs['formData'].clearValidate()
        //添加班组弹窗，打卡点字段默认选中所有打卡点
        this.getPointList('')
      })
    },
    editDetail(row) {
      this.getPointList(row.id, row)
    },
    getGroupInfo(row) {
      this.axios({
        method: 'post',
        url: 'api-e/cs/group/expand/finddetailbyid',
        data: {
          id: row.id,
        },
      }).then(
        (response) => {
          if (!response.data.hasError) {
            var info = response.data.result
            this.formData = {
              id: row.id,
              projectId: this.projectId,
              groupName: info.groupName,
              type: info.type,
              projectCompanyId: info.projectCompanyId,
              remark: info.remark,
              points: info.points,
              pointId: this.formData.pointId,
            }
            this.formData.projectName = this.projectItem.name
              ? this.projectItem.name
              : this.detailProjectName
            this.addOrEdit = 1
            this.formVisible = true
            this.selectArr = []
            this.$nextTick(function () {
              this.$refs.formData.validateField('pointId')
            })
          } else {
          }
        },
        (response) => {}
      )
      // .catch(error => {});
    },
    cancel(formData) {
      this.$refs['formData'].resetFields()
      this.formVisible = false
      this.selectArr = []
    },
    toSaveGroupInfo() {
      this.canLogin = true
      console.log(this.$refs.formData.validate)
      this.$refs.formData.validate((valid) => {
        console.log(valid)
        if (valid) {
          this.saveGroupInfo()
        } else {
          this.canLogin = false
        }
      })
    },
    saveGroupInfo() {
      this.formData.points = JSON.stringify(this.formData.pointId)
      this.axios({
        method: 'post',
        url: 'api-e/cs/group/expand/addoredit',
        data: this.formData,
      })
        .then(
          (response) => {
            if (!response.data.hasError) {
              this.$message({
                message: '操作成功',
                type: 'success',
              })
              this.formVisible = false
              this.canLogin = false
              this.$refs.pagination.getTableListData(this.pageNo, this.pageSize)
              this.selectArr = []
            } else {
              this.canLogin = false
              this.$message({
                message: response.data.errorMsg,
                type: 'error',
              })
            }
          },
          (response) => {
            this.canLogin = false
          }
        )
        .catch((error) => {
          this.canLogin = false
        })
    },
    getCompanyList() {
      this.axios({
        method: 'post',
        url: 'api-p/projectcompany/expand/findprojectcompany',
        data: {
          projectId: this.projectId,
          sysAppCode: this.filterField.sysAppCode,
        },
      })
        .then(
          (response) => {
            if (!response.data.hasError) {
              this.companyList = response.data.result
              if (this.isFB) {
                this.filterField.projectCompanyId = response.data.result[0].code
                this.formData.uscc = response.data.result[0].code
                this.$refs.pagination.getTableListData()
              }
            } else {
            }
          },
          (response) => {}
        )
        .catch((error) => {})
    },
    getGroupTypeList() {
      this.axios({
        method: 'post',
        url: 'api-bs/base/dicitem/findbytype',
        data: {
          type: 'WORKER_TYPE',
        },
      })
        .then(
          (response) => {
            if (!response.data.hasError) {
              this.groupTypeList = response.data.result
            } else {
            }
          },
          (response) => {}
        )
        .catch((error) => {})
    },
    toDel(row) {
      this.$confirm('确认删除班组?', '删除班组', {
        cancelButtonClass: 'btn-custom-cancel',
        type: 'warning',
      })
        .then(() => {
          this.del(row)
        })
        .catch(() => {
          // this.$message.error("删除失败");
        })
    },
    del(row) {
      this.axios({
        method: 'post',
        url: 'api-e/cs/group/expand/editbydelete',
        data: {
          id: row.id,
        },
      })
        .then(
          (response) => {
            if (!response.data.hasError) {
              this.$message({
                message: '删除成功',
                type: 'success',
              })
              this.$refs.pagination.getTableListData(this.pageNo, this.pageSize)
            } else {
              this.$message({
                message: response.data.errorMsg,
                type: 'error',
              })
            }
          },
          (response) => {}
        )
        .catch((error) => {})
    },
    getPointList(id, row) {
      this.axios({
        method: 'post',
        url: 'api-att/cs/point/expand/pointlist',
        data: {
          projectId: this.projectId,
          groupId: id,
        },
      }).then(
        (response) => {
          if (!response.data.hasError) {
            if (id) {
              this.formData.pointId = []
              response.data.result.forEach((items) => {
                this.formData.pointId.push(items.id)
              })
              this.getGroupInfo(row)
            } else {
              this.formData.pointId = []
              this.pointList = response.data.result
              response.data.result.forEach((items) => {
                this.formData.pointId.push(items.id)
              })
            }
          } else {
            this.$message({
              message: response.data.errorMsg,
              type: 'error',
            })
          }
        },
        (response) => {}
      )
      // .catch(error => {});
    },
    selectConstruction(item) {
      if (item.name == '联投投资有限公司') {
      }
    },
  },
  mounted() {
    window.addEventListener('scroll', this.handleScroll, true)
    let that = this
    this.$nextTick(function () {
      let tableHeightCur = this.$refs.tableBox1.$el.clientHeight
      let tableTop = this.$refs.tableBox.getBoundingClientRect().top
      if (tableHeightCur + tableTop > window.innerHeight) {
        this.tableHeight =
          this.$refs.mainCon.getBoundingClientRect().height - 86
      } else {
        document.getElementsByClassName('tableBoxCur').length &&
          (document.getElementsByClassName('tableBoxCur')[0].style.height =
            window.innerHeight - tableTop - 40 + 'px')
      }

      window.onresize = function () {
        if (!that.$refs.tableBox1) {
          return
        }
        let tableHeightCur = that.$refs.tableBox1.$el.clientHeight
        let tableTop = that.$refs.tableBox.getBoundingClientRect().top
        if (tableHeightCur + tableTop > window.innerHeight) {
          that.tableHeight =
            that.$refs.mainCon.getBoundingClientRect().height - 86
        } else {
          document.getElementsByClassName('tableBoxCur').length &&
            (document.getElementsByClassName('tableBoxCur')[0].style.height =
              window.innerHeight - tableTop - 40 + 'px')
        }
      }
    })
  },
}
</script>

<style scoped lang="less">
@media screen and (min-width: 1280px) and (max-width: 1366px) {
  .searchInputWidth /deep/.el-form-item__label {
    width: 82px;
  }
}
@import '../../../static/css/filterArea.less';
</style>
